package com.js.demo08;

import javafx.application.Application;
import javafx.scene.Cursor;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;

import java.net.URL;

public class Demo extends Application
{

    private Button button;

//    第3课初步认识stage窗口
    @Override
    public void start(Stage stage) throws Exception {


        stage.setTitle("Hello World");
        stage.setWidth(500);
        stage.setHeight(300);

        Group group = new Group();
        Button button1 = new Button("Click Me!1");
        Button button2 = new Button("Click Me!2");
        Button button3 = new Button("Click Me!3");

        button1.setLayoutY(20);
        button2.setLayoutY(40);
        button3.setLayoutY(60);

        group.getChildren().addAll(button1, button2, button3);

        group.getChildren().remove(button1);

//        关闭group的子组件自动设置宽高的功能
//        group.setAutoSizeChildren(false);


        Scene scene = new Scene(group);
        stage.setScene(scene);
        stage.show();
    }

    @Override
    public void init() throws Exception {
        super.init();
        System.out.println("init");
    }

    @Override
    public void stop() throws Exception {
        super.stop();
        System.out.println("stop");
    }
}
